package com.wyl.selenium.framework;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.Data;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * @Description
 * @Author WuYiLong
 * @Date 2024/1/2 17:00
 */
@Data
@MappedSuperclass
public class BaseEntity<T extends BaseEntity<T>> extends Model<T> {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.ASSIGN_ID)
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(columnDefinition = "bigint comment '主键'")
    private Long id;

    @Column(columnDefinition = "datetime(6) comment '创建时间'")
    private Date createTime;

    @Column(columnDefinition = "datetime(6) comment '更新时间'")
    private Date updateTime;

    @Column(columnDefinition = "int(1) default 0 comment '是否删除，0否，1是'")
    private Integer deleted;

    @Override
    public Serializable pkVal() {
        return this.id;
    }
}
